-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serve JS dependency files locally #186
Conversation
Oh, I was also wondering if this line is still necessary:
Since this highlightjs.min.css file doesn't exist in the project, it just returns a 404 when loading a sketch so I'm removing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for removing invalid url for the CSS file @jvfe.
About the WASM files, I think we can serve them too. The indexURL
from Pyodide is just a string prefix used to built the complete URL to both pyodide.asm.js and pyodide.asm.data. So, maybe just using one of the following should work:
{indexURL: "/static/js/pyodide/"}
// or even
{indexURL: "http://localhost:5000/static/js/pyodide/"}
Can you try that?
Hi, the first one worked, though I had to add a few other files too or else there would be some 404s. But seems to be working fine offline now. Thank you for your help. I rebased and pushed with the new updates, so the CI should be running. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jvfe for the work here. The local pyodide works smoothly with the local server, but the "pure web" version of it is breaking due to 404 because the pyp5js new
and neither compile
one copies the pyodide content to the sketche's static
dir. This the <script src="/static/js/pyodide/pyodide_v0.18.1.js"></script>
returns a 404.
Anyway, I don't think we should change this web version. This one should rely on CDN versions as most as possible.
I think the change here is more complex than what I predicted. Possibly we'll have to:
- Update pyodide
index.html
template to use a{{ pyodide_js_url }}
- Update pyodide
target_sketch.js.template
template to use a{{ pyodide_jindex_url }}
Maybe moving such configurations to the .properties.json
file can be a good strategy. If this is to complex or to big, I tackle that or even pair program with you on it. Let me know what do you think about it.
But, again, thanks for starting with this =)
@jvfe I spent some time on this and it can become more problematic. I'll work on it later this Thursday to make this feasible. |
Oh wow, my mistake for not testing the pure web version. So should I revert all changes in
No problem, I'll wait on your input. |
@jvfe I've merged this PR and started a new one to implement the required tooling to be able to control if the user will use CDN or will host pyodide by their own. The PR with all the changes is #191 and there's a single commit grouping all the TODO notes (d72f0f2) about how to make the same CDN/local logic to work with pyodide too. Thanks for starting with this work! |
I believe this is the only JS/CSS dependency that wasn't being served locally, but I might've missed something.
Now, from what I can see, the only files being loaded over a connection are the Pyodide WASM files that get loaded from here:
pyp5js/pyp5js/templates/pyodide/target_sketch.js.template
Line 1651 in 9209b1e
I'm not really sure how to proceed with these, since they are data/binary files and not JS files.